<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="/Xqkq/Public/Libs/easyui/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="/Xqkq/Public/Libs/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/Xqkq/Public/Libs/easyui/themes/color.css">
<script type="text/javascript" src="/Xqkq/Public/Libs/easyui/jquery.min.js"></script>
<script type="text/javascript"   src="/Xqkq/Public/Libs/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"   src="/Xqkq/Public/Libs/easyui/locale/easyui-lang-zh_CN.js"></script>



<!-- Plupload 引入文件 -->
<link rel="stylesheet" href="/Xqkq/Public/Libs/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css" type="text/css" media="screen" />
<script type="text/javascript" src="/Xqkq/Public/Libs/plupload/plupload.full.min.js"></script>
<script type="text/javascript" src="/Xqkq/Public/Libs/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
    <style>
        html,body {margin:0px; padding:0px; height: 100%;}
    </style>


</head>

<body>
    <div class="easyui-layout" style="width:100%;height:99%;">

        <div data-options="region:'north'" style="height:50px;padding:0;margin: 0;">

    <p style="text-align: right; padding-right:10px; margin-top: 5px;">
        欢迎回来,<?php echo ($_SESSION['admin']['tname']); ?> &nbsp;&nbsp;&nbsp;<a target="_blank" href="/Xqkq/index.php">显示首页</a> | <a href="javascript:void(0);" onclick="javascript:editPass();">修改密码</a> | <a href="javascript:void(0);" onclick="javascript:editInfo()">修改资料</a> | <a href="/Xqkq/admin.php/Index/loginout">退出</a>
    </p>

    <!--  修改密码Dialog  -->
    <div id="editpwd" class="easyui-dialog" style="width:400px;height:250px;padding:10px 20px"
             closed="true" buttons="#dlg-buttons1">
            <div class="ftitle">修改密码</div>
            <form id="pwd-fm" method="post" novalidate style="margin: 0;padding: 10px 30px;">
                <div class="fitem">
                    <label>旧密码:</label>
                    <input  name="oldpwd" type="password" class="easyui-textbox"  value = "default" required="true" >
                </div>
                <div class="fitem">
                    <label>新密码:</label>
                    <input  name="pwd" type="password" class="easyui-textbox" required="true" >
                </div>
                <div class="fitem">
                    <label>确认密码:</label>
                    <input  name="rpwd" type="password" class="easyui-textbox" required="true" >
                </div>
            </form>
        </div>
        <div id="dlg-buttons1">
            <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="savePwd()" style="width:90px">Save</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#editpwd').dialog('close')" style="width:90px">Cancel</a>
        </div>

        <!--  修改资料Dialog  -->
        <div id="editinfo" class="easyui-dialog" style="width:400px;height:250px;padding:10px 20px"
             closed="true" buttons="#dlg-buttons">
            <div class="ftitle">修改资料</div>
            <form id="info-form" method="post" novalidate style="    margin: 0;padding: 10px 30px;">
                <div class="fitem">
                    <label>用户名:</label>
                    <input  name="username" editable="false" class="easyui-textbox" required="true" value="<?php echo ($_SESSION['admin']['username']); ?>">
                </div>
                <div class="fitem">
                    <label>真实姓名:</label>
                    <input  name="tname" class="easyui-textbox" value="<?php echo ($_SESSION['admin']['tname']); ?>" required="true" >
                </div>
                <div class="fitem">
                    <label>电子邮箱:</label>
                    <input  name="email" class="easyui-textbox" required="true" value="<?php echo ($_SESSION['admin']['email']); ?>">
                </div>
                <div class="fitem">
                    <label>电话:</label>
                    <input  name="telphone" class="easyui-textbox" required="true" value="<?php echo ($_SESSION['admin']['telphone']); ?>">
                </div>
            </form>
        </div>
        <div id="dlg-buttons">
            <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveInfo()" style="width:90px">Save</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#editinfo').dialog('close')" style="width:90px">Cancel</a>
        </div>
</div>

<script>
    function editPass(){
        $('#editpwd').dialog('open').dialog('setTitle','修改密码');
        url = '/Xqkq/admin.php/Admin/edit_pwd';
    }

    function editInfo(){
        $('#editinfo').dialog('open').dialog('setTitle','修改资料');
        url = '/Xqkq/admin.php/Admin/edit_info';
    }

    function savePwd() {
        $('#pwd-fm').form('submit',{
                url: url,
                onSubmit: function(){
                    return $(this).form('validate');
                },
                success: function(result){
                    var result = eval('('+result+')');
                    if (result.errorMsg){
                        $.messager.show({
                            title: 'Error',
                            msg: result.errorMsg
                        });
                    } else {
                        $('#editpwd').dialog('close'); 
                        alert("密码修改成功,请重新登录"); 
                        location.reload();  
                    }
                }
            });
    }


    function saveInfo() {
        $('#info-form').form('submit',{
                url: url,
                onSubmit: function(){
                    return $(this).form('validate');
                },
                success: function(result){
                    var result = eval('('+result+')');
                    if (result.errorMsg){
                        $.messager.show({
                            title: 'Error',
                            msg: result.errorMsg
                        });
                    } else {
                        $('#editinfo').dialog('close'); 
                        $.messager.alert('提示',"资料修改成功！"); 
                        location.reload();  
                    }
                }
            });
    }

</script>
        <div data-options="region:'south',split:true" style="height:30px; padding-top: 5px; text-align: center; border-bottom:0px; color: #666;">
        Copyright © 2010 E8网络工作室www.e8net.cn
</div>
        <div data-options="region:'west',split:true,title:'管理菜单',iconCls:'application_view_tile'" style="width:180px;">
    <ul id="menu" class="easyui-tree" style="margin-left:10px; margin-top:5px;" data-options="url:'/Xqkq/admin.php/Public/get_menu',method:'post',animate:true,lines:true"></ul>
</div>

<script>
    $("#menu").tree({
        onClick:function(node){
            //location.href=node.url;
            //$('#iframe').arrt('src',node.url);
            //alert();
            $(window.parent.document).find("#iframe").attr("src",node.url); 
        }
    })
</script>

        <div data-options="region:'center',title:'工作区间',iconCls:'icon-app-columns'" style="overflow-y: hidden">

            <iframe id="iframe" frameborder="0" scrolling="auto" src="/Xqkq/admin.php/Dashboard" width="100%"  height="100%;"></iframe>

        </div>
    </div>

</body>
</html>